package com.cordershy.controller;

import com.cordershy.pojo.debt;
import com.cordershy.service.debtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class debtController {
    @Autowired
    debtService debtService;
    @RequestMapping("/debt/selectAll")
    public List<debt> debtList(@RequestParam("username") String username){

        return debtService.selectAll(username);
    }
    @RequestMapping("/debt/select")
    public debt selectDebt(@RequestParam(value = "debtid") int debtid){
        return debtService.selectById(debtid);
    }
    @RequestMapping("/debt/addDebt")
    public void addDebt(debt debt){
        debtService.addDebt(debt);
    }
    @RequestMapping("/debt/updateDebt")
    public void updateDebt(debt debt){
        debtService.updateDebt(debt);
    }
    @RequestMapping("/debt/deleteDebt")
    public void deleteDebt(@RequestParam(value = "debtid") int debtid){
        debtService.deleteDebt(debtid);
    }
}
